﻿using ReflectionStudio.Core.Events;
using ReflectionStudio.Core.Helpers;
using System;
using System.ComponentModel;
using System.Data;
using System.Windows;
namespace WPFExcelReport
{
    /// <summary>
    /// Interaction logic for ProductionOrder.xaml
    /// </summary>
    public partial class TAV13
    {
        public TAV13()
        {
            if (DesignerProperties.GetIsInDesignMode(this))
                return;
            MV = new VABFOLGE();
            this.DataContext = MV;
            InitializeComponent();
            IsQC = false;
        }

        public override void QueryCommand(object sender, RoutedEventArgs e)
        {
            if (LFD == "000000")
            {
                LFD = "";
            }
            dwData = TBMain.NewRow();
            dwData["ABFMANDANT"] = app.Mandant;
            dwData["ABFAUFKRS"] = " AND ABFAUFKRS LIKE'" + KRS.Trim() + "%'";
            dwData["ABFAUFLFD"] = " AND ABFAUFLFD LIKE'" + LFD.Trim() + "%'";
            dwData["ABFAUFPOS"] = " AND ABFAUFPOS LIKE'" + POS.Trim() + "%'";

            SResult = TMV.QABF14(dwData);
            MergeData(SResult, false);
            base.QueryCommand(sender, e);

        }
        public override void OnEXAUFChg(string vlaue)
        {
            TBMain.Clear();
            if (EXAUF.Length < 11)
                return;
            KRS = EXAUF.Substring(0, 2);
            LFD = EXAUF.Substring(2, 6);
            POS = EXAUF.Substring(8, 3);
            dwData = TBMain.NewRow();
            dwData["ABFMANDANT"] = app.Mandant;
            dwData["ABFAUFKRS"] = " AND ABFAUFKRS ='" + KRS + "'";
            dwData["ABFAUFLFD"] = " AND ABFAUFLFD ='" + LFD + "'";
            dwData["ABFAUFPOS"] = " AND ABFAUFPOS ='" + POS + "'";
            SResult = TMV.QABF14(dwData);
            MergeData(SResult, false);
            base.OnEXAUFChg(vlaue);
        }


    }
}
